// @ts-ignore

/* eslint-disable */
import { request } from "umi";
/** 获取当前的用户 GET /api/currentUser */

// 列表
export async function getList(params, options) {
  return request("/baseApi/originaldata/datasourcelistdata", {
    method: "GET",
    params: { ...params },
    ...(options || {}),
  });
}

// // 详情
// export async function getDetail(options) {
//   return request(`/api/sysPost/post/${options}`, {
//     method: 'GET'
//   })
// }

// 详情
export async function getDetail(params, options) {
  return request("/baseApi/originaldata/getdataSourcebyid", {
    method: "GET",
    params: { ...params },
    ...(options || {}),
  });
}

// 增加
export async function addField(body, options) {
  return request("/baseApi/originaldata/addOrUpdateResoure", {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
    },
    data: body,
    ...(options || {}),
  });
}

export async function upadataField(body, options) {
  return request("/baseApi/originaldata/addOrUpdateResoure", {
    method: "PUT",
    headers: {
      "Content-Type": "application/json",
    },
    data: body,
    ...(options || {}),
  });
}

/** 删除  */

export async function removeField(options) {
  return request(`/baseApi/originaldata/delete/${options}`, {
    method: "DELETE",
  });
}

// 类别列表
export async function getTree(params, options) {
  return request("/baseApi/originalcatalogue/getDataUnitList", {
    method: "GET",
    params: { ...params },
    ...(options || {}),
  });
}

// 列表
export async function sendunitcmd(params, options) {
  return request("/baseApi/dynamicitem/sendunitcmd", {
    method: "GET",
    params: { ...params },
    ...(options || {}),
  });
}

// export async function getTree(params, options) {
//   return request('/baseApi/sysDept/page', {
//     method: 'GET',
//     params: { ...params },
//     ...(options || {})
//   })
// }
